using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Dal.Models.Mapping
{
    public class CHACTORMap : EntityTypeConfiguration<CHACTOR>
    {
        public CHACTORMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID });

            // Properties
            this.Property(t => t.NAME)
                .HasMaxLength(50);

            this.Property(t => t.PHONE)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.EMAIL)
                .HasMaxLength(50);

            this.Property(t => t.ADDRESS)
                .HasMaxLength(100);

            this.Property(t => t.TEAM)
                .HasMaxLength(50);

            this.Property(t => t.OWNER)
               .HasMaxLength(50);

            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            // Table & Column Mappings
            this.ToTable("CHACTOR");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.PHONE).HasColumnName("PHONE");
            this.Property(t => t.EMAIL).HasColumnName("EMAIL");
            this.Property(t => t.ADDRESS).HasColumnName("ADDRESS");
            this.Property(t => t.TEAM).HasColumnName("TEAM");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.OWNER).HasColumnName("OWNER");
        }
    }
}
